package com.dk.testflow;

import com.dk.domain.ApiAutoTestEntity;

/**
 *接口自动化测试责任链配置
 */
public class ApiAutoTestChainConfig {
    /**
     * 获取接口自动化测试责任链对象
     * @return
     */
    public static ApiAutoTestChain getApiAutoTestChain(){
        //获取测试数据执行链
        ApiAutoTestChain getCaseDataLink = new GetCaseDataLink();
        //参数化执行链
        ApiAutoTestChain parameterizationLink = new ParameterizationLink();
        //前置动作执行链
        ApiAutoTestChain beforeActionLink = new BeforeActionLink();
        //请求执行链
        ApiAutoTestChain apiRequestLink = new ApiRequestLink();
        //后置动作执行链
        ApiAutoTestChain afterActionLink = new AfterActionLink();
        //断言执行链
        ApiAutoTestChain assertLink = new AssertLink();

        //链式设置
        getCaseDataLink.setTestLink(parameterizationLink);
        parameterizationLink.setTestLink(beforeActionLink);
        beforeActionLink.setTestLink(apiRequestLink);
        apiRequestLink.setTestLink(assertLink);
        assertLink.setTestLink(afterActionLink);
        return getCaseDataLink;
    }
}
